<%--
  Created by IntelliJ IDEA.
  User: zjk
  Date: 2018-08-02
  Time: 8:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>计划付款</title>
    <link rel="shortcut icon" href="easyui/css/images/favicon.ico"/>
    <link rel="stylesheet" href="css/flipclock.css">
    <link href="css/CalcSS3.css" rel="stylesheet" type="text/css"/>
    <link href="css/index.css" rel="stylesheet" type="text/css"/>
    <link href="easyui/css/easyui.css" rel="stylesheet" type="text/css">
    <link href="easyui/css/easyui_animation.css" rel="stylesheet" type="text/css">
    <link href="easyui/css/easyui_plus.css" rel="stylesheet" type="text/css">
    <link href="easyui/css/insdep_theme_default.css" rel="stylesheet" type="text/css">
    <link href="easyui/css/icon.css" rel="stylesheet" type="text/css">
    <link href="easyui/css/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">


    <!-- 引入 ECharts 文件 -->
    <script src="js/echarts.js"></script>
    <!--放入自定义的图表-->
    <script src="js/monitor.js"></script>
    <script type="text/javascript" src="easyui/js/jquery.min.js"></script>
    <script type="text/javascript" src="easyui/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="easyui/js/jquery.insdep-extend.min.js"></script>
    <style>
        .by {
            padding: 10px;
            text-align: center;
        }
    </style>

</head>
<body>
<!-- 引入公用表格和表单样式 -->
<link href="css/utils/utilsDatagrid.css" rel="stylesheet" type="text/css">
<link href="css/utils/utilsForm.css" rel="stylesheet" type="text/css">
<!--动态添加操作栏图标-->
<div class="easyui-layout" data-options="fit:true, border:false">
    <div data-options="region:'center'" style="padding:5px;">
        <table id="planingpay-table" class="easyui-datagrid table-chance" data-options="fit:true,striped:true,height:350,fitColumns:true,checkOnSelect:false,
   autoRowHeight:true,nowrap:false,pagination:true,url:'/getPlaningPayList',
   method:'post',
pageList:[20,30,40,50],pageSize:20">
            <thead>
            <tr class="datagrid-header-row">
                <th data-options="field:'code',width:10,align:'center',checkbox:true">编码</th>
                <th data-options="field:'id',width:40,align:'center',formatter:function(value,row,index){
					return row.planingPay.planingPayId}">ID
                </th>
                <th data-options="field:'pname',width:100,align:'center',formatter:function(value,row,index){
					return row.planingPay.planingPayMoney}">金额
                </th>
                <th data-options="field:'pnumber',width:60,align:'center',formatter:function(value,row,index){
					return row.planingPay.planingPayTime}">计划付款日期
                </th>
                <%--<th data-options="field:'pcnumber',width:40,align:'center',formatter:function(value,row,index){--%>
                <%--return row.clientInfo.cname}">客户--%>
                <%--</th>--%>
                <th data-options="field:'pprice',width:50,align:'center',formatter:function(value,row,index){
					return row.purchase.purtheme}">采购单
                </th>
                <th data-options="field:'pmoney',width:60,align:'center',formatter:function(value,row,index){
					return row.userinfo.uname}">所有者
                </th>
                <th data-options="field:'operate',width:80,align:'center'" formatter="format">操作
                </th>
            </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>
</div>

<
<script type="text/javascript">
    function format(value, row, index) {
        var str = '<a name="planingpaydelete"></a>';
        return str;
    }

    $(function () {
        $("#planingpay-table").datagrid({
            onLoadSuccess: function (data) {
                $("a[name='planingpaydelete']").linkbutton({
                    width: 40, iconCls: 'icon-ok2', plain: true,
                    onClick: function () {
                        var rows = $('#planingpay-table').datagrid('getRows');
                        $("#planingpay-table").datagrid({
                            onClickCell: function (index) {
                                var planingPayId = rows[index].planingPay.planingPayId;
                                $.post(
                                    "/setPlaningPayMoneyAlreadyPay",
                                    {
                                        planingPayId: planingPayId,
                                        rows: JSON.stringify(rows[index].planingPay)
                                    },
                                    function (data) {
                                        if (data == true) {
                                            $("#planingpay-table").datagrid('reload')
                                        } else {
                                            $.messager.alert("提示", "操作失败")
                                        }
                                    }
                                )
                                $('#planingpay-table').datagrid({
                                    onClickCell: function (index) {

                                    }
                                });
                            }
                        })

                    }
                })
            }
        })
    })
</script>
</body>
</html>
